package org.wicket.jbpm.engine.handlers;

import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.access.BeanFactoryLocator;
import org.springframework.beans.factory.access.BeanFactoryReference;
import org.springmodules.workflow.jbpm31.JbpmFactoryLocator;

public abstract class SpringAssignmentHandler implements AssignmentHandler
{

    /**
	 * 
	 */
    private static final long serialVersionUID = -1430720801387237267L;

    public SpringAssignmentHandler()
    {
	// The following implementation is derived from Spring Modules v0.4
	BeanFactoryLocator factoryLocator = new JbpmFactoryLocator();
	BeanFactoryReference factory = factoryLocator.useBeanFactory(null);
	initialiseHandler(factory.getFactory());
    }

    /**
     * Initialise Action Handler
     * 
     * @param factory
     *            Spring bean factory for accessing Alfresco beans
     */
    protected abstract void initialiseHandler(BeanFactory factory);
}
